package cn.chia.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import cn.chia.back.dao.ISenderDAO;
import cn.chia.pojo.Peisongren;
import cn.chia.service.SenderService;
@Service
public class SenderServiceImpl implements SenderService {
	private ISenderDAO senderDao;

	@Resource(name="senderDAOImpl")
	public void setSenderDao(ISenderDAO senderDao) {
		this.senderDao = senderDao;
	}
	/*
	 * 于辉  根据id查找配送员
	 */
	public Peisongren findFrontById(Integer id) throws Exception {
		return senderDao.findById(id);
	}
	/*
	 * 于辉  查询所有配送员
	 */
	public List<?> findall() throws Exception {
		return senderDao.findAll();
	}
	/*
	 * 于辉  隐藏配送员
	 */
	public void delete(Peisongren peisongren) throws Exception {
		senderDao.doUpdate(peisongren);
	}
	/*
	 * 于辉  添加配送员
	 */
	public void insert(Peisongren peisongren) throws Exception {
		senderDao.doCreate(peisongren);
	}
	/*
	 * 于辉  修改配送员
	 */
	public void update(Peisongren peisongren) throws Exception {
		senderDao.doUpdate(peisongren);
	}

	public Peisongren findByUserTel(String psrname, String psrtel)
			throws Exception {
		List<?> list = senderDao.findByUserTel(psrname,psrtel);
		return list.size()>0?(Peisongren)list.get(0):null;
	}
	public List<?> findOrderByStateUser(String state) throws Exception {
		return senderDao.findOrderByStateUser(state);
	}
}
